import type { GetContainer } from '@/utils/Dom/Portal';
import type ScrollLocker from '@/utils/Dom/scrollLocker';

// Content -- 点击按钮打开dialog 鼠标的位置
export type TMousePosition = { x: number; y: number } | null;

type IClassNames = {
  wrapper?: string;
  header?: string;
  body?: string;
  footer?: string;
  mask?: string;
};

type IStyles = {
  wrapper?: React.CSSProperties;
  header?: React.CSSProperties;
  body?: React.CSSProperties;
  footer?: React.CSSProperties;
  mask?: React.CSSProperties;
};
export interface YmDialogProps {
  prefixCls?: string;
  classNames?: IClassNames;
  styles?: IStyles;
  open: boolean;
  keyboard?: boolean; // Dialog -- index
  mask?: boolean; // 是否需要遮罩 Dialog -- index
  zIndex?: number; //Mask / rc-dialog-warp
  maskClosable?: boolean; // Dialog -- 点击遮罩是否关闭
  afterClose?: () => any;
  onClose?: (e: React.SyntheticEvent) => any; // dialog         //reat合成事件
  onCancel?: (e: React.SyntheticEvent) => any;
  onOk?: (e: React.SyntheticEvent) => any;
  closable?: boolean; //Panel-- 是否显示右上角的关闭按钮
  destroyOnClose?: boolean; // Portal
  forceRender?: boolean;
  mousePosition?: TMousePosition;
  closeIcon?: React.ReactNode;
  title: React.ReactNode;
  footer?: React.ReactNode;
  width?: string | number; // Panel -- rc-dialog - style
  height?: string | number;
  dialogStyle?: React.CSSProperties;
  rootClassName?: string;
  getContainer?: GetContainer; // Portal
  modalRender?: (node: React.ReactNode) => React.ReactNode;
  children?: React.ReactNode;
  centered?: boolean;
  okText?: React.ReactNode;
  cancelText?: React.ReactNode;
}

export type TPortalParams = {
  scrollLocker: ScrollLocker;
};

export interface MaskProps {
  prefixCls: string;
  open: boolean;
  className?: string;
  style?: React.CSSProperties;
  motionName: string;
}

export interface ContentProps extends PanelProps {
  forceRender?: boolean;
  motionName: string;
  ariaId: string;
  destroyOnClose?: boolean;
  onVisibleChanged: (visible: boolean) => void;
  mousePosition?: TMousePosition;
}

export interface PanelProps {
  open: boolean;
  prefixCls: string;
  classNames?: IClassNames;
  styles?: IStyles;
  className?: string;
  style?: React.CSSProperties;
  title: React.ReactNode;
  ariaId: string;
  footer?: React.ReactNode;
  closable?: boolean;
  closeIcon?: React.ReactNode;
  onClose: (e: React.SyntheticEvent) => any;
  onCancel?: (e: React.SyntheticEvent) => any;
  onOk?: (e: React.SyntheticEvent) => any;
  children?: React.ReactNode;
  modalRender?: (node: React.ReactNode) => React.ReactNode;
  onMouseDown: React.MouseEventHandler;
  onMouseUp: React.MouseEventHandler;
  holderRef?: React.Ref<HTMLDivElement>;
  width?: string | number; // Panel -- rc-dialog - style
  height?: string | number;
  dialogStyle?: React.CSSProperties;
  okText?: React.ReactNode;
  cancelText?: React.ReactNode;
}
